﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Expression;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using System.ComponentModel;
using Castle.ActiveRecord.Queries;

namespace Mang24k99.Model.GOLD
{

    [ActiveRecord(Table = "KT_GOLD_SALEPRICE_History")]
    public partial class MKtGoldSalepriceHistory : ActiveRecordBase
    {
        /// <summary>
        /// Deleteses the specified where.
        /// </summary>
        /// <param name="where">The where.</param>
        public static void Deletes(string where)
        {
            DeleteAll(typeof(MKtGoldSalepriceHistory), where);
        }
        /// <summary>
        /// Deleteses the specified pk values.
        /// </summary>
        /// <param name="pkValues">The pk values.</param>
        public static void Deletes(System.Collections.IEnumerable pkValues)
        {
            DeleteAll(typeof(MKtGoldSalepriceHistory), pkValues);
        }

        /// <summary>
        /// Selects all.
        /// </summary>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectAll()
        {
            return (IList<MKtGoldSalepriceHistory>)FindAll(typeof(MKtGoldSalepriceHistory));
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectAll(params ICriterion[] criteria)
        {
            return (IList<MKtGoldSalepriceHistory>)FindAll(typeof(MKtGoldSalepriceHistory), criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectAll(Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtGoldSalepriceHistory>)FindAll(typeof(MKtGoldSalepriceHistory), orders, criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectAll(DetachedCriteria detachedCriteria, params Order[] orders)
        {
            return (IList<MKtGoldSalepriceHistory>)FindAll(typeof(MKtGoldSalepriceHistory), detachedCriteria, orders);
        }


        /// <summary>
        /// Selects all query.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public static IList<MKtGoldSalepriceHistory> SelectAllQuery(SimpleQuery query)
        {
            return (IList<MKtGoldSalepriceHistory>)ExecuteQuery(query);
        }


        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectByPrimaryKey(object ID)
        {
            return (MKtGoldSalepriceHistory)FindByPrimaryKey(typeof(MKtGoldSalepriceHistory), ID, false);
        }

        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectOne(DetachedCriteria detachedCriteria)
        {
            return (MKtGoldSalepriceHistory)FindOne(typeof(MKtGoldSalepriceHistory), detachedCriteria);
        }
        /// <summary>
        /// Selects the one.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectOne(params ICriterion[] criteria)
        {
            return (MKtGoldSalepriceHistory)FindOne(typeof(MKtGoldSalepriceHistory), criteria);
        }

        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectFirst(params ICriterion[] criteria)
        {
            return (MKtGoldSalepriceHistory)FindFirst(typeof(MKtGoldSalepriceHistory), criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectFirst(Order[] orders, params ICriterion[] criteria)
        {
            return (MKtGoldSalepriceHistory)FindFirst(typeof(MKtGoldSalepriceHistory), orders, criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static MKtGoldSalepriceHistory SelectFirst(DetachedCriteria detachedCriteria, Order[] orders)
        {
            return (MKtGoldSalepriceHistory)FindFirst(typeof(MKtGoldSalepriceHistory), detachedCriteria, orders);

        }

        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLByProperty(string property, object value)
        {
            return (IList<MKtGoldSalepriceHistory>)FindAllByProperty(typeof(MKtGoldSalepriceHistory), property, value);
        }
        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="orderByColumn">The order by column.</param>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLByProperty(string orderByColumn, string property, object value)
        {
            return (IList<MKtGoldSalepriceHistory>)FindAllByProperty(typeof(MKtGoldSalepriceHistory), orderByColumn, property, value);
        }

        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLSliced(int firstResult, int maxResult, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtGoldSalepriceHistory>)SlicedFindAll(typeof(MKtGoldSalepriceHistory), firstResult, maxResult, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLSliced(int firstResult, int maxResult, params ICriterion[] criteria)
        {
            return (IList<MKtGoldSalepriceHistory>)SlicedFindAll(typeof(MKtGoldSalepriceHistory), firstResult, maxResult, criteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtGoldSalepriceHistory>)SlicedFindAll(typeof(MKtGoldSalepriceHistory), firstResult, maxResult, orders, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtGoldSalepriceHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtGoldSalepriceHistory>)SlicedFindAll(typeof(MKtGoldSalepriceHistory), firstResult, maxResult, orders, criteria);
        }

        /// <summary>
        /// Countses this instance.
        /// </summary>
        /// <returns></returns>
        public static int Counts()
        {
            return Count(typeof(MKtGoldSalepriceHistory));
        }
        /// <summary>
        /// Countses the specified detached criteria.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static int Counts(DetachedCriteria detachedCriteria)
        {
            return Count(typeof(MKtGoldSalepriceHistory), detachedCriteria);
        }
        /// <summary>
        /// Countses the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static int Counts(params ICriterion[] criteria)
        {
            return Count(typeof(MKtGoldSalepriceHistory), criteria);
        }


        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public static bool Exist(object id)
        {
            return Exists(typeof(MKtGoldSalepriceHistory), id);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static bool Exist(DetachedCriteria detachedCriteria)
        {
            return Exists(typeof(MKtGoldSalepriceHistory), detachedCriteria);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static bool Exist(params ICriterion[] criteria)
        {
            return Exists(typeof(MKtGoldSalepriceHistory), criteria);
        }
        protected override void OnDelete()
        {
            DeleteTime = DateTime.Now;
            base.OnDelete();
        }





        /// <summary>
        /// Gets or sets the ID.(ID)
        /// </summary>
        /// <value>The ID.</value>
        /// <remarks>
        /// ID
        /// </remarks>
        [PrimaryKey(PrimaryKeyType.Native, "ID"),
        ValidateNonEmpty("ID不能为空"),
        ValidateRange(0, 2147483647, "ID的值要在0到2147483647之间"),
        ]
        public int ID
        {
            get
            {
                return _ID;
            }
            set
            {
                _ID = value;
            }
        }


        /// <summary>
        /// Gets or sets the ProcductNO.(ProcductNO)
        /// </summary>
        /// <value>The ProcductNO.</value>
        /// <remarks>
        /// ProcductNO
        /// </remarks>
        [Property("PROCDUCT_NO"),
        ValidateRange(0, 2147483647, "ProcductNO的值要在0到2147483647之间"),
        ]
        public int? ProcductNO
        {
            get
            {
                return _ProcductNO;
            }
            set
            {
                _ProcductNO = value;
            }
        }


        /// <summary>
        /// Gets or sets the BuyPrice.(BuyPrice)
        /// </summary>
        /// <value>The BuyPrice.</value>
        /// <remarks>
        /// BuyPrice
        /// </remarks>
        [Property("BUY_PRICE"),
        ]
        public decimal BuyPrice
        {
            get
            {
                return _BuyPrice;
            }
            set
            {
                _BuyPrice = value;
            }
        }


        /// <summary>
        /// Gets or sets the SalePrice.(SalePrice)
        /// </summary>
        /// <value>The SalePrice.</value>
        /// <remarks>
        /// SalePrice
        /// </remarks>
        [Property("SALE_PRICE"),
        ]
        public decimal SalePrice
        {
            get
            {
                return _SalePrice;
            }
            set
            {
                _SalePrice = value;
            }
        }


        /// <summary>
        /// Gets or sets the ChargeFee.(ChargeFee)
        /// </summary>
        /// <value>The ChargeFee.</value>
        /// <remarks>
        /// ChargeFee
        /// </remarks>
        [Property("CHARGE_FEE"),
        ]
        public string ChargeFee
        {
            get
            {
                return _ChargeFee;
            }
            set
            {
                _ChargeFee = value;
            }
        }


        /// <summary>
        /// Gets or sets the TotalPrice.(TotalPrice)
        /// </summary>
        /// <value>The TotalPrice.</value>
        /// <remarks>
        /// TotalPrice
        /// </remarks>
        [Property("TOTAL_PRICE"),
        ]
        public decimal TotalPrice
        {
            get
            {
                return _TotalPrice;
            }
            set
            {
                _TotalPrice = value;
            }
        }


        /// <summary>
        /// Gets or sets the UpdateTime.(UpdateTime)
        /// </summary>
        /// <value>The UpdateTime.</value>
        /// <remarks>
        /// UpdateTime
        /// </remarks>
        [Property("UPDATE_TIME"),
        ]
        public DateTime? UpdateTime
        {
            get
            {
                return _UpdateTime;
            }
            set
            {
                _UpdateTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the IsValidate.(IsValidate)
        /// </summary>
        /// <value>The IsValidate.</value>
        /// <remarks>
        /// IsValidate
        /// </remarks>
        [Property("IS_VALIDATE"),
        ValidateRange(0, 2147483647, "IsValidate的值要在0到2147483647之间"),
        ]
        public int? IsValidate
        {
            get
            {
                return _IsValidate;
            }
            set
            {
                _IsValidate = value;
            }
        }


        /// <summary>
        /// Gets or sets the InputTime.(InputTime)
        /// </summary>
        /// <value>The InputTime.</value>
        /// <remarks>
        /// InputTime
        /// </remarks>
        [Property("INPUT_TIME"),
        ]
        public DateTime? InputTime
        {
            get
            {
                return _InputTime;
            }
            set
            {
                _InputTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the ModifyTime.(ModifyTime)
        /// </summary>
        /// <value>The ModifyTime.</value>
        /// <remarks>
        /// ModifyTime
        /// </remarks>
        [Property("MODIFY_TIME"),
        ]
        public DateTime? ModifyTime
        {
            get
            {
                return _ModifyTime;
            }
            set
            {
                _ModifyTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the DeleteTime.(DeleteTime)
        /// </summary>
        /// <value>The DeleteTime.</value>
        /// <remarks>
        /// DeleteTime
        /// </remarks>
        [Property("DELETE_TIME"),
        ]
        public DateTime? DeleteTime
        {
            get
            {
                return _DeleteTime;
            }
            set
            {
                _DeleteTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the PriceDatetime.(PriceDatetime)
        /// </summary>
        /// <value>The PriceDatetime.</value>
        /// <remarks>
        /// PriceDatetime
        /// </remarks>
        [Property("PRICE_DATETIME"),
        ]
        public DateTime? PriceDatetime
        {
            get
            {
                return _PriceDatetime;
            }
            set
            {
                _PriceDatetime = value;
            }
        }


        /// <summary>
        /// Gets or sets the PriceChange.(PriceChange)
        /// </summary>
        /// <value>The PriceChange.</value>
        /// <remarks>
        /// PriceChange
        /// </remarks>
        [Property("PRICE_CHANGE"),
        ]
        public decimal PriceChange
        {
            get
            {
                return _PriceChange;
            }
            set
            {
                _PriceChange = value;
            }
        }


        /// <summary>
        /// Gets or sets the LastbuyPrice.(LastbuyPrice)
        /// </summary>
        /// <value>The LastbuyPrice.</value>
        /// <remarks>
        /// LastbuyPrice
        /// </remarks>
        [Property("LASTBUY_PRICE"),
        ]
        public decimal LastbuyPrice
        {
            get
            {
                return _LastbuyPrice;
            }
            set
            {
                _LastbuyPrice = value;
            }
        }


        /// <summary>
        /// Gets or sets the LastsalePrice.(LastsalePrice)
        /// </summary>
        /// <value>The LastsalePrice.</value>
        /// <remarks>
        /// LastsalePrice
        /// </remarks>
        [Property("LASTSALE_PRICE"),
        ]
        public decimal LastsalePrice
        {
            get
            {
                return _LastsalePrice;
            }
            set
            {
                _LastsalePrice = value;
            }
        }


        /// <summary>
        /// Gets or sets the IsLastprice.(IsLastprice)
        /// </summary>
        /// <value>The IsLastprice.</value>
        /// <remarks>
        /// IsLastprice
        /// </remarks>
        [Property("IS_LASTPRICE"),
        ValidateRange(0, 2147483647, "IsLastprice的值要在0到2147483647之间"),
        ]
        public int? IsLastprice
        {
            get
            {
                return _IsLastprice;
            }
            set
            {
                _IsLastprice = value;
            }
        }



        private int _ID;

        private int? _ProcductNO;

        private decimal _BuyPrice;

        private decimal _SalePrice;

        private string _ChargeFee;

        private decimal _TotalPrice;

        private DateTime? _UpdateTime;

        private int? _IsValidate;

        private DateTime? _InputTime;

        private DateTime? _ModifyTime;

        private DateTime? _DeleteTime;

        private DateTime? _PriceDatetime;

        private decimal _PriceChange;

        private decimal _LastbuyPrice;

        private decimal _LastsalePrice;

        private int? _IsLastprice;
        


    }
}
